<template>
	<view class="news_content">
		<view class="goods_list_item" v-for="(item,index) in list" :key="index" @tap="navTo(item)">
			<view class="main">
				<view class="goods_desc" :style="{'padding-right':item.logoImage?'50upx':'0'}">
					<view class="title" v-html="item.title"></view>
					<!-- <view class="desc">{{setDate(item.created)}}</view> -->
					<view class="desc">{{moment(item.created).format('YYYY-MM-DD HH:mm:ss')}}</view>
				</view>
				<view class="show_img" v-if="item.logoImage">
					<image :src="item.logoImage" mode="scaleToFill"></image>
				</view>

			</view>
			<view class="msg" v-if="isEnd && index == list.length-1">
				<image src="../../../static/home/line.png" mode="widthFix" class="left-line"></image>
				<text class="text">没有更多内容啦</text>
				<image src="../../../static/home/line.png" mode="widthFix" class="right-line"></image>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: []
			},
			isEnd: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {

			}
		},
		methods: {
			navTo(cur) {
				uni.navigateTo({
					url: `/pages/index/selectedDetail?id=${cur.id}`,
				})
			},
			setDate(n) { //设置时间
				let timer = "";
				let date = new Date(n);
				let y = date.getFullYear();
				let m = date.getMonth() + 1;
				let d = date.getDate();
				let h = date.getHours();
				let mm = date.getMinutes();
				// timer = add0(y)+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm);
				timer = add0(m) + '月' + add0(d) + '日 ' + add0(h) + ':' + add0(mm);

				function add0(m) {
					return m < 10 ? '0' + m : m
				}
				return timer;
			},
		}
	}
</script>

<style scoped lang="less">
	.news_content {
		width: 100%;
		padding-bottom: 40px;

		.goods_list_item {
			width: 100%;
			position: relative;

			.main {
				width: 100%;
				display: flex;
				justify-content: space-between;
				// align-items: center;
				align-content: space-between;
				padding: 0 30upx;
				padding-bottom: 20upx;
				margin-bottom: 20upx;
				border-bottom: 1px solid rgba(200, 200, 201, 0.15);

				.goods_desc {
					flex: 1%;
					padding-right: 50upx;
					display: flex;
					flex-wrap: wrap;
					align-content: space-between;

					.title {
						width: 100%;
						font-size: 30upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #0A0A0A;
						line-height: 42upx;
						vertical-align: top;
						text-align: justify;
					}

					.desc {
						width: 100%;
						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #7A7A7D;
						line-height: 36upx;
						vertical-align: bottom;
					}
				}

				.show_img {
					width: 280upx;

					image {
						width: 100%;
						height: 150upx;
						border-radius: 8upx;
					}
				}
			}
		}

		.msg {
			text-align: center;
			font-size: 24upx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #BCBCBC;
			margin-top: 30upx;
			display: flex;
			align-items: center;
			justify-content: center;
			
			.text{
				margin: 0 20upx;
			}

			.left-line {
				width: 100upx;
			}

			.right-line {
				width: 100upx;
				transform: rotate(-180deg);
			}

			// padding-bottom: 100upx;
		}
	}
</style>
